package com.mtbu.bean.base;
import java.util.*;
import java.text.SimpleDateFormat;
import org.json.JSONObject;
import my.json.core.JsonAble;
public abstract class SysUserBase implements JsonAble {
    private Map<String, Object> dirtyProperties = new HashMap<String, Object>();
    //
    private int id = 0;
    //
    private String userName = "";
    //
    private String password = "";
    //
    private int roleID = 0;
    //
    private String stepPermission = "";
    //
    private String permission = "";
    //
    private String platFormIDs = "";
    //
    private String memo = "";
    //
    private Date createTime = null;
    public int getId(){
        return this.id;
    }
    public void setId(int id){
        this.id = id;
    }
    public String getUserName(){
        return this.userName;
    }
    public void setUserName(String userName){
        this.userName = userName;
        dirtyProperties.put("userName", userName);
    }
    public String getPassword(){
        return this.password;
    }
    public void setPassword(String password){
        this.password = password;
        dirtyProperties.put("password", password);
    }
    public int getRoleID(){
        return this.roleID;
    }
    public void setRoleID(int roleID){
        this.roleID = roleID;
        dirtyProperties.put("roleID", roleID);
    }
    public String getStepPermission(){
        return this.stepPermission;
    }
    public void setStepPermission(String stepPermission){
        this.stepPermission = stepPermission;
        dirtyProperties.put("stepPermission", stepPermission);
    }
    public String getPermission(){
        return this.permission;
    }
    public void setPermission(String permission){
        this.permission = permission;
        dirtyProperties.put("permission", permission);
    }
    public String getPlatFormIDs(){
        return this.platFormIDs;
    }
    public void setPlatFormIDs(String platFormIDs){
        this.platFormIDs = platFormIDs;
        dirtyProperties.put("platFormIDs", platFormIDs);
    }
    public String getMemo(){
        return this.memo;
    }
    public void setMemo(String memo){
        this.memo = memo;
        dirtyProperties.put("memo", memo);
    }
    public Date getCreateTime(){
        return this.createTime;
    }
    public String getCreateTime_ToDateString(){
        if(createTime==null) return "";
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        return formatter.format(this.createTime);
    }
    public String getCreateTime_ToTimeString(){
        if(createTime==null) return "";
        SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
        return formatter.format(this.createTime);
    }
    public String getCreateTime_ToDateTimeString(){
        if(createTime==null)   return "";
        SimpleDateFormat   formatter   =   new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return formatter.format(this.createTime);
    }
    public void setCreateTime(Date createTime){
        this.createTime = createTime;
        dirtyProperties.put("createTime", createTime);
    }
    public Map<String, Object> getDirtyProperties() {
        return this.dirtyProperties;
    }
    public JSONObject toJSON() throws Exception {
        JSONObject json = new JSONObject();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        json.put("id", this.getId());
        if(userName!=null){
           json.put("userName",this.getUserName());
        }
        if(password!=null){
           json.put("password",this.getPassword());
        }
        json.put("roleID", this.getRoleID());
        if(stepPermission!=null){
           json.put("stepPermission",this.getStepPermission());
        }
        if(permission!=null){
           json.put("permission",this.getPermission());
        }
        if(platFormIDs!=null){
           json.put("platFormIDs",this.getPlatFormIDs());
        }
        if(memo!=null){
           json.put("memo",this.getMemo());
        }
        if(createTime!=null){
            json.put("createTime",formatter.format(this.getCreateTime()));
        }
        return json;
    }
    public void fromJSON(JSONObject json) throws Exception {
        if(json==null) return;
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try{
            if(json.get("id") != null){
                this.setId(Integer.parseInt(json.get("id")+""));
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("userName") != null){
                this.setUserName(json.get("userName")+"");
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("password") != null){
                this.setPassword(json.get("password")+"");
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("roleID") != null){
                this.setRoleID(Integer.parseInt(json.get("roleID")+""));
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("stepPermission") != null){
                this.setStepPermission(json.get("stepPermission")+"");
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("permission") != null){
                this.setPermission(json.get("permission")+"");
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("platFormIDs") != null){
                this.setPlatFormIDs(json.get("platFormIDs")+"");
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("memo") != null){
                this.setMemo(json.get("memo")+"");
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("createTime") != null){
                this.setCreateTime(formatter.parse(json.get("createTime")+""));
            }
        }catch(Exception ex){
        }
    }
    public void fromMap(Map<String, String> json) throws Exception {
        if(json==null) return;
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try {
            if(json.containsKey("id".toLowerCase())){
                this.setId(Integer.parseInt(json.get("id".toLowerCase())+""));
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("userName".toLowerCase())){
                this.setUserName(json.get("userName".toLowerCase())+"");
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("password".toLowerCase())){
                this.setPassword(json.get("password".toLowerCase())+"");
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("roleID".toLowerCase())){
                this.setRoleID(Integer.parseInt(json.get("roleID".toLowerCase())+""));
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("stepPermission".toLowerCase())){
                this.setStepPermission(json.get("stepPermission".toLowerCase())+"");
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("permission".toLowerCase())){
                this.setPermission(json.get("permission".toLowerCase())+"");
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("platFormIDs".toLowerCase())){
                this.setPlatFormIDs(json.get("platFormIDs".toLowerCase())+"");
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("memo".toLowerCase())){
                this.setMemo(json.get("memo".toLowerCase())+"");
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("createTime".toLowerCase())){
                this.setCreateTime(formatter.parse(json.get("createTime".toLowerCase())+""));
            }
        }catch(Exception ex){
        }
    }
}
